package com.smy.jkds.po;

import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import javax.validation.constraints.NotBlank;

/**
 * <p>
 * 任务记录表
 * </p>
 *
 * @author 01140
 * @since 2021-10-30
 */
@Data
  @TableName("cts.jkds_task")
public class TTaskRecord implements Serializable {

    private static final long serialVersionUID = 1L;

      //主键
       @TableId("id")
      private String id;

      //用户ID
     @TableField("user_id")
//     @NotBlank
    private String userId;

      //用户名称
     @TableField("user_name")
    private String userName;

      //标题
     @TableField("title")
//     @NotBlank
    private String title;

      //周期
     @TableField("circle")
//     @NotBlank
    private Integer circle;

      //任务时长（单位：分钟）
     @TableField("task_time")
    private Integer taskTime;

      //是否计时（0=否，1=是）
     @TableField("timekeeping")
    private Integer timekeeping;

      //工作时长（单位：分钟）
     @TableField("work_time")
    private Integer workTime;

      //休息时长（单位：分钟）
     @TableField("rest_time")
    private Integer restTime;

      //暂停时长（单位：分钟）
     @TableField("pause_time")
    private Integer pauseTime;

      //计划开始时间
     @TableField("plan_time")
    private Date planTime;

      //实际起始时间
     @TableField("start_time")
    private Date startTime;

      //实际结束时间
     @TableField("end_time")
    private Date endTime;

      //创建日期
     @TableField("create_date")
    private String createDate;

      //创建时间
     @TableField("create_time")
    private Date createTime;

      //更新时间
     @TableField("update_time")
    private Date updateTime;

public QueryWrapper<TTaskRecord> queryWrapper(){
        QueryWrapper<TTaskRecord> queryWrapper = new QueryWrapper<>();
    if(id != null){
        queryWrapper.eq(ColumnEnum.id.name(),id);
    }
    if(userId != null){
        queryWrapper.eq(ColumnEnum.user_id.name(),userId);
    }
    if(userName != null){
        queryWrapper.eq(ColumnEnum.user_name.name(),userName);
    }
    if(title != null){
        queryWrapper.eq(ColumnEnum.title.name(),title);
    }
    if(circle != null){
        queryWrapper.eq(ColumnEnum.circle.name(),circle);
    }
    if(taskTime != null){
        queryWrapper.eq(ColumnEnum.task_time.name(),taskTime);
    }
    if(timekeeping != null){
        queryWrapper.eq(ColumnEnum.timekeeping.name(),timekeeping);
    }
    if(workTime != null){
        queryWrapper.eq(ColumnEnum.work_time.name(),workTime);
    }
    if(restTime != null){
        queryWrapper.eq(ColumnEnum.rest_time.name(),restTime);
    }
    if(pauseTime != null){
        queryWrapper.eq(ColumnEnum.pause_time.name(),pauseTime);
    }
    if(planTime != null){
        queryWrapper.eq(ColumnEnum.plan_time.name(),planTime);
    }
    if(startTime != null){
        queryWrapper.eq(ColumnEnum.start_time.name(),startTime);
    }
    if(endTime != null){
        queryWrapper.eq(ColumnEnum.end_time.name(),endTime);
    }
    if(createDate != null){
        queryWrapper.eq(ColumnEnum.create_date.name(),createDate);
    }
    if(createTime != null){
        queryWrapper.eq(ColumnEnum.create_time.name(),createTime);
    }
    if(updateTime != null){
        queryWrapper.eq(ColumnEnum.update_time.name(),updateTime);
    }
        return queryWrapper;
}


public enum ColumnEnum {
        id,
        user_id,
        user_name,
        title,
        circle,
        task_time,
        timekeeping,
        work_time,
        rest_time,
        pause_time,
        plan_time,
        start_time,
        end_time,
        create_date,
        create_time,
        update_time,
      ;
}
}
